package com.dingup.mock.feign.client;

import com.dingup.mock.enums.MarkTypeEnum;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;

/**
 * Created by wancheng on 2018/11/12.
 */
@Component
@FeignClient(value = "p-homework")
public interface HomeworkFeignClient {
    /**
     * 保存老师批改记录
     *
     * @param homeworkRecordId
     * @param examId
     * @param endTime
     */
    @RequestMapping(value = "/feign/correct/update_teacher_correct.do", method = RequestMethod.POST)
    public void updateTeacherCorrect(@RequestParam("homeworkRecordId") Integer homeworkRecordId,
                                     @RequestParam("examId") String examId,
                                     @RequestParam("examIdentity") Integer examIdentity,
                                     @RequestParam("endTime") Date endTime);

    /**
     * 修改记录的批改状态
     *
     * @param homeworkRecordId
     */
    @RequestMapping(value = "/feign/correct/update_correct_homework_status.do", method = RequestMethod.POST)
    public void updateCorrectHomeworkStatus(@RequestParam("homeworkRecordId") Integer homeworkRecordId,
                                            @RequestParam("type") MarkTypeEnum type);

    /**
     * 保存作业进度
     *
     * @param id                  Integer
     * @param homeworkRecordId    Integer
     * @param homeworkQuestionNum Integer
     * @param examId              String
     * @param correct             String
     * @param total               String
     */
    @RequestMapping(value = "/feign/homework_record/save_homework_progress.do", method = RequestMethod.POST)
    void saveHomeworkProgress(@RequestParam("homeworkRecordId") Integer homeworkRecordId,
                              @RequestParam("homeworkQuestionNum") Integer homeworkQuestionNum,
                              @RequestParam("id") Integer id,
                              @RequestParam("examId") String examId,
                              @RequestParam("correct") Integer correct,
                              @RequestParam("total") Integer total);

    /**
     * 根据 homeworkRecordId 获取 HomeworkId
     *
     * @param homeworkRecordId Integer
     * @return Integer
     */
    @RequestMapping(value = "/feign/homework_record/get_homework_id.do", method = RequestMethod.POST)
    Integer getHomeworkIdByHomeworkRecordId(@RequestParam("homeworkRecordId") Integer homeworkRecordId);
}
